/**
 * 
 */
package com.explgo.backend.rest;

import java.util.List;

import org.apache.commons.lang3.StringUtils;

import com.explgo.backend.service.impl.CityDictionary;
import com.explgo.backend.service.impl.CityDictionary.CityEntry;

/**
 * @author Jialiang(Cain) Wang
 *
 */
public class CityController extends AbstractController {
	private static final int MINIMAL_KEYWORD_LENGTH = 3;
	
	private CityDictionary cityDictionary = new CityDictionary();
	
	/**
	 * Searches for cities that matches the specified name.
	 * */
	public List<CityEntry> searchCity(String name) {
		if (StringUtils.isNotBlank(name) && name.length() > MINIMAL_KEYWORD_LENGTH) {
			return cityDictionary.searchCity(name);
		}
		
		return null;
	}
}
